package com.gxa.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.gxa.common.R;
import com.gxa.entity.DistrictSysContact;
import com.gxa.mapper.HomeMonitoringMapper;
import com.gxa.service.HomeMonitoringService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class HomeMonitoringServiceImpl implements HomeMonitoringService {

    @Autowired
    HomeMonitoringMapper homeMonitoringMapper;
    @Override
    public R findHomeMonitoringByConditions(Integer currentPage, Integer pageSize, String name, String sex, String idNum, String phoneNum, String source, String status, String normalOrAbnormal) {
        R r = new R();

        Page page = PageHelper.startPage(currentPage,pageSize);

        List<DistrictSysContact> districtSysContactList = homeMonitoringMapper.findHomeMonitoringByConditions(name,sex,idNum,phoneNum, source, status, normalOrAbnormal);

        int total = (int) page.getTotal();

        Map map = new HashMap();

        map.put("total",total);
        map.put("districtSysContactList",districtSysContactList);

        r.setCode(200);
        r.setMsg("查询成功");
        r.setData(map);

        return r;
    }



}
